﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Profile;

namespace WebSite.cn
{
    public partial class account_pay : BasePage
    {
        // Fields
        public string address = "";
        public string address1 = "";

        public string cardcode = "";
        public string cardid = "0";
        public string cardmsg = "未使用礼品卡";
        public string cardpas = "";
        public string cardprice = "0";
        public string carid = "0";

        public string cname = "";
        public string cname1 = "";
        public string content = "";
        public string content1 = "";
        public string email = "";
        public string email1 = "";
        public string gpoint = "0";

        public string payinfo = "";
        public string phone = "";
        public string phone1 = "";
        public string point = "0";
        public string post = "";
        public string post1 = "";
        public string scoremsg = "未使用积分";
        public string scoreprice = "0";
        public string ship = "0";
        public string tel = "";
        public string tel1 = "";
        public string totalprice = "0";
        public string totalscore = "0";

        // Methods
        private void Bind()
        {
            string str2;
            if ((base.Request.Form["carid"] == null) || (base.Request.Form["cname"] == null))
            {
                base.Response.Write("<script language=javascript>window.location.href='index.aspx';</script>");
                base.Response.End();
            }

            if (LoginMember.UserCardCodeList != null)
            {
 

            }


            this.carid = re.replace(base.Request.Form["carid"]);
            this.cname = re.replace(base.Request.Form["cname"]);
            this.tel = re.replace(base.Request.Form["tel"]);
            this.phone = re.replace(base.Request.Form["phone"]);
            this.post = re.replace(base.Request.Form["address"]);
            this.email = re.replace(base.Request.Form["email"]);
            this.address = re.replace(base.Request.Form["address"]);
            this.content = re.replace(base.Request.Form["content"]);
            this.totalprice = re.replace(base.Request.Form["totalprice"]);
            this.totalscore = re.replace(base.Request.Form["totalscore"]);
            //if (this.Session["memberid"] != null)
            //{
            //   // this.gpoint = re.replace(base.Request.Form["gpoint"]);
            //   // this.point = re.replace(base.Request.Form["point"]);
            //    //this.cardcode = re.replace(base.Request.Form["cardcode"]);
            //    //this.cardpas = re.replace(base.Request.Form["cardpas"]);
            //    if (this.gpoint == "0")
            //    {
            //        this.scoremsg = "未使用积分";
            //        this.scoreprice = "0";
            //    }
            //    if (this.gpoint == "1")
            //    {
            //        this.scoremsg = "支付：";
            //        this.scoreprice = base.Request.Form["score"];
            //    }
            //    if (this.gpoint == "2")
            //    {
            //        this.scoremsg = "支付：";
            //        if (Convert.ToSingle(this.point) > Convert.ToSingle(base.Request.Form["score"]))
            //        {
            //            this.scoreprice = base.Request.Form["score"];
            //        }
            //        else
            //        {
            //            this.scoreprice = this.point;
            //        }
            //    }
            //    if ((this.cardcode != "") && (this.cardpas != ""))
            //    {
            //        DataTable table = SQLAccess.GreatDs("select * from DB_Card where cardcode='" + this.cardcode + "' and cardpas='" + this.cardpas + "' and states=0").Tables[0];
            //        if (table.Rows.Count > 0)
            //        {
            //            this.cardmsg = "使用礼品卡：" + table.Rows[0]["cardcode"].ToString();
            //            this.cardid = table.Rows[0]["cardid"].ToString();
            //            if (table.Rows[0]["types"].ToString() == "0")
            //            {
            //                this.cardprice = table.Rows[0]["cards1"].ToString();
            //            }
            //            else
            //            {
            //                this.cardprice = ((1f - (Convert.ToSingle(table.Rows[0]["cards1"].ToString()) / 100f)) * Convert.ToSingle(this.totalprice)) + "";
            //            }
            //        }
            //    }
            //}
            if (base.Request.Form["chk1"] == "1")
            {
                this.cname1 = this.cname;
                this.tel1 = this.tel;
                this.phone1 = this.phone;
                this.post1 = this.post;
                this.email1 = this.email;
                this.address1 = this.address;
            }
            this.ship = base.Request.Form["ship"];
            if (base.Request.Form["pay"] == "1")
            {
                str2 = "select payid,payname,paycontent,pay from DB_Pay where payauthor='银行转账' and flag=1";
            }
            else
            {
                str2 = "select payid,payname,paycontent,pay from DB_Pay where payauthor='在线支付' and flag=1";
            }
            DataTable table2 = SQLAccess.GreatDs(str2).Tables[0];
            if (table2.Rows.Count > 0)
            {
                foreach (DataRow row in table2.Rows)
                {
                    this.payinfo = this.payinfo + "<tr>";
                    this.payinfo = this.payinfo + "<td width='3%' align='left' bgcolor='#FFFFFF'><input type='radio' name='pay' value='" + row["payid"].ToString() + "'></td>";
                    string payinfo = this.payinfo;
                    this.payinfo = payinfo + "<td width='85%' align='left' bgcolor='#FFFFFF'><strong><font color='#ff0000'>" + row["payname"].ToString() + "</font></strong><br />" + row["paycontent"].ToString() + "</td>";
                    this.payinfo = this.payinfo + "<td width='12%' align='left' bgcolor='#FFFFFF'><strong>手续费：" + row["pay"].ToString() + "</strong></td>";
                    this.payinfo = this.payinfo + "</tr>";
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                this.Bind();
            }
        }



    }
}